<template>
 
   <!-- @change="countChanged" ref="numbox" -->
  <div class="mui-numbox" data-numbox-min='1' style="height:25px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>

    <!-- :value="initcount" 绑定的值 ShopcarContainer里传来的 -->
    <input id="test" class="mui-input-numbox" type="number" :value="initcount" @change="countChange" ref="nobox"/>
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js' 
import {mapMutations} from 'vuex'
export default {
    
  data() {
    return {
      property: "value"
    };
  },
  methods: {
    countChange() {
      //父组件向子组件传值
      // console.log("goodsinfo_nobox = "+ this.$refs.nobox.value);
      // this.$emit('func', parseInt(this.$refs.nobox.value));

      this.updateGoodsCount({id:this.id,count:parseInt(this.$refs.nobox.value)})
    },
    ...mapMutations(["updateGoodsCount"])
  },
   mounted(){
    mui('.mui-numbox').numbox();
  },
  props:["initcount","id"]

 
};
</script>
<style lang="scss" scoped>
</style>